//: Playground - noun: a place where people can play

import UIKit

// string 是一个结构体
// string支持便利，可以和NSString之间相互转换

let str: String = "hello"
let s = "world"

// 字符串的遍历
for c in str.characters {
    print(c)
}

str.contains("he")

// 字符串的拼接
let str3 = str + s;

let name = "air"
let age = 18;
let desc = "my name is \(name) my age is \(age) my"

// 字符串的格式化
let min = 2
let second = 9
let timeString = String(format: "%03d:%02d", min, second);

// 字符串的截取
let urlString = "http://www.baidu.com";
//urlString.substring(to: <#T##String.Index#>)
// string 转化为NSString
var scheme = (urlString as NSString) .substring(to: 4);
var subString = (urlString as NSString) .substring(with: NSMakeRange(3, 9));




